package ithink.link;

import ithink.link.base.utils.InfluxdbHelper;
import ithink.link.base.utils.LoggerHelper;
import ithink.link.service.LinkService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by zaqb on 17-10-23.
 */
public class App {
    public static void main(String[] args) {

        LoggerHelper.init();
        Logger LOGGER = LoggerFactory.getLogger(App.class);
        try {
            if(!ConfigHelper.load()){
                throw new RuntimeException( "error config" );
            }
            InfluxdbHelper.init(ConfigHelper.getInfluxIp(), ConfigHelper.getInfluxPort(), ConfigHelper.getName());
            LinkService service = new LinkService(ConfigHelper.getName(), ConfigHelper.getVersion());
            service.start();
        } catch (Exception e) {
            LOGGER.error("app : {}", e);
        }
    }
}
